<?php


namespace app\admin\controller;


use app\BaseController;
use app\service\Y;
use think\captcha\facade\Captcha;
use think\facade\Cache;

class Common extends BaseController
{

    /**
     * 清楚缓存
     * @return \think\response\Json
     */
    public function clear_cache(): \think\response\Json
    {
        $tag = input('param.tag', 'admin_cache');
        if ($tag == 'all') {
            Cache::clear();
        } else {
            Cache::tag($tag)->clear();
        }
        return Y::success([], '清理成功');
    }

    /**
     * 验证码
     * @return \think\Response
     */
    public function verify(): \think\Response
    {
        return Captcha::create();
    }
}